CREATE TABLE [dbo].[Tb_Bienes]
(
[IDBien] [int] NOT NULL IDENTITY(1, 1),
[Descripcion] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Abreviatura] [varchar] (35) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Rubro] [int] NOT NULL,
[Tipo] [int] NOT NULL,
[UnidadMedida] [int] NOT NULL,
[UnidadesEmpaque] [int] NOT NULL,
[RegistraStock] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Activo] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CodigoBarra] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Tb_Bienes] ADD CONSTRAINT [PK_Tb_Bienes] PRIMARY KEY CLUSTERED  ([IDBien]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Tb_Bienes] WITH NOCHECK ADD CONSTRAINT [FK_Tb_Bienes_Tb_RubrosBienes] FOREIGN KEY ([Rubro]) REFERENCES [dbo].[Tb_RubrosBienes] ([IDRubroBien])
GO
ALTER TABLE [dbo].[Tb_Bienes] WITH NOCHECK ADD CONSTRAINT [FK_Tb_Bienes_Tb_TiposDeBienes] FOREIGN KEY ([Tipo]) REFERENCES [dbo].[Tb_TiposDeBienes] ([IDTipoBien])
GO
ALTER TABLE [dbo].[Tb_Bienes] WITH NOCHECK ADD CONSTRAINT [FK_Tb_Bienes_Tb_UnidadesDeMedida] FOREIGN KEY ([UnidadMedida]) REFERENCES [dbo].[Tb_UnidadesDeMedida] ([IDUnidadMedida])
GO
EXEC sp_bindrule N'[dbo].[S-N]', N'[dbo].[Tb_Bienes].[RegistraStock]'
GO
EXEC sp_bindrule N'[dbo].[S-N]', N'[dbo].[Tb_Bienes].[Activo]'
GO
